import os

# 遍历文件夹中的每个文件并删除
def clearFile(folderPath):

    for filename in os.listdir(folderPath):
        file_path = os.path.join(folderPath, filename)
        # 确保是文件而不是子目录
        if os.path.isfile(file_path):
            try:
                os.remove(file_path)
                print(f"已删除 {file_path}")
            except Exception as e:
                print(f"无法删除 {file_path}. 原因: {e}")